﻿using System;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace QuanLyKhachSan
{
    public partial class frmTimKiemThietBiPhong : XtraForm
    {
        public frmTimKiemThietBiPhong()
        {
            InitializeComponent();
        }
        public string rdName = "";
        public string thongtintimkiem = "";
        private void rdButton_Click(object sender, EventArgs e)
        {
            RadioButton rd = sender as RadioButton;
            rdName = rd.Name;
            switch (rdName)
            {
                case "rdFindByRoomType":
                    groupBox2.Visible = true;
                    break;
                case "rdFindAll":
                    groupBox2.Visible = false;
                    break;
            }
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            rdName = "";
            thongtintimkiem = "";
            this.Close();
        }

        private void btnTimKiem_Click(object sender, EventArgs e)
        {
            if (rdName=="rdFindByRoomType"&&cbLoaiPhong.SelectedIndex==-1)
            {
                MessageBox.Show("Chưa nhập thông tin tìm kiếm");
            }
            else if (rdName == "rdFindAll")
            {
                this.Close();
            }
            else
            {
                thongtintimkiem = cbLoaiPhong.SelectedValue.ToString();
                this.Close();
            }
        }

        private void frmTimKiemThietBiPhong_Load(object sender, EventArgs e)
        {
            this.loaiPhongTableAdapter.Fill(this.qLKHACHSANDataSet.LoaiPhong);
            rdFindByRoomType.Checked = false;
            rdFindAll.Checked = false;
            cbLoaiPhong.SelectedIndex = -1;
        }
    }
}
